#include "log.h"

QFile *Log::file = NULL;

void Log::add(QString str)
{
    QString time = QDateTime::currentDateTime().toString("hh:mm:ss.zzz");
    QString message = "[" + time + "] " + str;
    std::cout<< message.toAscii().data() << "\n";
    QTextStream out( Log::file);
    out  << message << "\n" ;
}

void Log::createLog(QString name)
{
    Log::file = new QFile(name+".log");
    if(!Log::file->open( QIODevice::WriteOnly | QIODevice::Text)) return;
}
